Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Automatic Reference Counting</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Automatic_Reference_Counting"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Automatic_Reference_Counting rootpage-Automatic_Reference_Counting skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Automatic Reference Counting</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<style data-mw-deduplicate="TemplateStyles:r1236090951">
/* start https://en.wikipedia.org/ */


.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}


/* end https://en.wikipedia.org/ */
</style><div role="note" class="hatnote navigation-not-searchable">This article is about a specific implementation of a language feature. For the general technology, see <a href="Reference_counting" title="Reference counting">Reference counting</a>.</div>
<p><b>Automatic Reference Counting</b> (<b>ARC</b>) is a <a href="Memory_management" title="Memory management">memory management</a> feature of the <a href="Clang" title="Clang">Clang</a> <a href="Compiler" title="Compiler">compiler</a> providing automatic <a href="Reference_counting" title="Reference counting">reference counting</a> for the <a href="Objective-C" title="Objective-C">Objective-C</a> and <a href="Swift_(programming_language)" title="Swift (programming language)">Swift</a> <a href="Programming_language" title="Programming language">programming languages</a>. At compile time, it inserts into the <a href="Object_code" title="Object code">object code</a> <a href="Object-oriented_programming#Dynamic_dispatch/message_passing" title="Object-oriented programming">messages</a> <code>retain</code> and <code>release</code><sup id="cite_ref-Ars_1-0" class="reference"><a href="#cite_note-Ars-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-Kochan_2-0" class="reference"><a href="#cite_note-Kochan-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> which increase and decrease the reference count at run time, marking for <a href="Deallocation" class="mw-redirect" title="Deallocation">deallocation</a> those <a href="Object_(computer_science)" title="Object (computer science)">objects</a> when the number of references to them reaches zero.
</p><p>ARC differs from <a href="Tracing_garbage_collection" title="Tracing garbage collection">tracing garbage collection</a> in that there is no background process that deallocates the objects asynchronously at runtime.<sup id="cite_ref-Hoffman_3-0" class="reference"><a href="#cite_note-Hoffman-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> Unlike tracing garbage collection, ARC does not handle <a href="Reference_counting#reference_cycle" title="Reference counting">reference cycles</a> automatically. This means that as long as there are "strong" references to an object, it will not be deallocated. Strong cross-references can accordingly create <a href="Deadlock_(computer_science)" title="Deadlock (computer science)">deadlocks</a> and <a href="Memory_leak" title="Memory leak">memory leaks</a>. It is up to the developer to break cycles by using <a href="Weak_reference" title="Weak reference">weak references</a>.<sup id="cite_ref-clang_4-0" class="reference"><a href="#cite_note-clang-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup>
</p><p><a href="Apple_Inc." title="Apple Inc.">Apple Inc.</a> deploys ARC in their operating systems, such as <a href="MacOS" title="MacOS">macOS</a> (<span class="nowrap">OS X</span>) and <a href="IOS" title="IOS">iOS</a>. Limited support (ARCLite)<sup id="cite_ref-Mention_of_ARCLite,_Inc_5-0" class="reference"><a href="#cite_note-Mention_of_ARCLite,_Inc-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> has been available since <a href="Mac_OS_X_Snow_Leopard" title="Mac OS X Snow Leopard"><span class="nowrap">Mac OS X</span> Snow Leopard</a> and <a href="IOS_4" title="IOS 4">iOS 4</a>, with complete support following in <a href="Mac_OS_X_Lion" class="mw-redirect" title="Mac OS X Lion"><span class="nowrap">Mac OS X</span> Lion</a> and <a href="IOS_5" title="IOS 5">iOS 5</a>.<sup id="cite_ref-Sakamato_6-0" class="reference"><a href="#cite_note-Sakamato-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup> Garbage collection was declared deprecated in <a href="OS_X_Mountain_Lion" title="OS X Mountain Lion"><span class="nowrap">OS X</span> Mountain Lion</a>, in favor of ARC, and removed from the Objective-C <a href="Runtime_library" title="Runtime library">runtime library</a> in <a href="MacOS_Sierra" title="MacOS Sierra">macOS Sierra</a>.<sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup>
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Objective-C">Objective-C</h2></div>
<p>The following rules are enforced by the compiler when ARC is turned on:
</p>
<ul><li><code>retain</code>, <code>release</code>, <code>retainCount</code>, <code>autorelease</code> or <code>dealloc</code> cannot be sent to objects. Instead, the compiler inserts these messages at compile time automatically, including <code>[super dealloc]</code> when <code>dealloc</code> is overridden.<sup id="cite_ref-Transit_9-0" class="reference"><a href="#cite_note-Transit-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup><div class="mw-highlight mw-highlight-lang-objc mw-content-ltr" dir="ltr"><pre><span class="c1">// Without ARC</span>
<span class="p">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">dealloc</span>
<span class="p">{</span>
<span class="w"> </span><span class="p">[[</span><span class="bp">NSNotificationCenter</span><span class="w"> </span><span class="n">defaultCenter</span><span class="p">]</span><span class="w"> </span><span class="n">removeObserver</span><span class="o">:</span><span class="nb">self</span><span class="p">];</span>
<span class="w"> </span><span class="p">[</span><span class="nb">super</span><span class="w"> </span><span class="n">dealloc</span><span class="p">];</span>
<span class="p">}</span>

<span class="c1">// With ARC</span>
<span class="p">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">dealloc</span>
<span class="p">{</span>
<span class="w"> </span><span class="p">[[</span><span class="bp">NSNotificationCenter</span><span class="w"> </span><span class="n">defaultCenter</span><span class="p">]</span><span class="w"> </span><span class="n">removeObserver</span><span class="o">:</span><span class="nb">self</span><span class="p">];</span>
<span class="w"> </span><span class="c1">// [super dealloc] is called automatically</span>
<span class="p">}</span>
</pre></div></li>
<li>Programs cannot cast directly between <code>id</code> and <code>void *</code>.<sup id="cite_ref-Transit_9-1" class="reference"><a href="#cite_note-Transit-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup> This includes casting between Foundation objects and Core Foundation objects. Programs must use special casts, or calls to special functions, to tell the compiler more information about an object's lifetime.<div class="mw-highlight mw-highlight-lang-objc mw-content-ltr" dir="ltr"><pre><span class="c1">// Without ARC</span>
<span class="p">-</span> <span class="p">(</span><span class="bp">NSString</span><span class="w"> </span><span class="o">*</span><span class="p">)</span><span class="nf">giveMeAString</span>
<span class="p">{</span>
<span class="w"> </span><span class="n">CFStringRef</span><span class="w"> </span><span class="n">myString</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="nb">self</span><span class="w"> </span><span class="n">someMethodThatCreatesACFString</span><span class="p">];</span>
<span class="w"> </span><span class="bp">NSString</span><span class="w"> </span><span class="o">*</span><span class="n">newString</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="bp">NSString</span><span class="w"> </span><span class="o">*</span><span class="p">)</span><span class="n">myString</span><span class="p">;</span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="p">[</span><span class="n">newString</span><span class="w"> </span><span class="n">autorelease</span><span class="p">];</span>
<span class="p">}</span>

<span class="c1">// With ARC</span>
<span class="p">-</span> <span class="p">(</span><span class="bp">NSString</span><span class="w"> </span><span class="o">*</span><span class="p">)</span><span class="nf">giveMeAString</span>
<span class="p">{</span>
<span class="w"> </span><span class="n">CFStringRef</span><span class="w"> </span><span class="n">myString</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="nb">self</span><span class="w"> </span><span class="n">someMethodThatCreatesACFString</span><span class="p">];</span><span class="w"> </span><span class="c1">// retain count is 1</span>
<span class="w"> </span><span class="bp">NSString</span><span class="w"> </span><span class="o">*</span><span class="n">newString</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="k">__bridge_transfer</span><span class="w"> </span><span class="bp">NSString</span><span class="w"> </span><span class="o">*</span><span class="p">)</span><span class="n">myString</span><span class="p">;</span><span class="w"> </span><span class="c1">// the ownership has now been transferred into ARC</span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">newString</span><span class="p">;</span>
<span class="p">}</span>
</pre></div></li>
<li>An autorelease pool can be used to allocate objects temporarily and retain them in memory until the pool is "drained". Without ARC, an <code>NSAutoreleasePool</code> object can be created for this purpose. ARC uses <code>@autoreleasepool</code> blocks instead, which encapsulate the allocation of the temporary objects and deallocates them when the end of the block is reached.<sup id="cite_ref-Transit_9-2" class="reference"><a href="#cite_note-Transit-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup> <div class="mw-highlight mw-highlight-lang-objc mw-content-ltr" dir="ltr"><pre><span class="c1">// Without ARC</span>
<span class="p">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">loopThroughArray:</span><span class="p">(</span><span class="bp">NSArray</span><span class="w"> </span><span class="o">*</span><span class="p">)</span><span class="nv">array</span>
<span class="p">{</span>
<span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="p">(</span><span class="kt">id</span><span class="w"> </span><span class="n">object</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">array</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="bp">NSAutoreleasePool</span><span class="w"> </span><span class="o">*</span><span class="n">pool</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[[</span><span class="bp">NSAutoreleasePool</span><span class="w"> </span><span class="n">alloc</span><span class="p">]</span><span class="w"> </span><span class="n">init</span><span class="p">];</span>
<span class="w"> </span><span class="c1">// Create a lot of temporary objects</span>
<span class="w"> </span><span class="p">[</span><span class="n">pool</span><span class="w"> </span><span class="n">drain</span><span class="p">];</span>
<span class="w"> </span><span class="p">}</span>
<span class="p">}</span>

<span class="c1">// With ARC</span>
<span class="p">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">loopThroughArray:</span><span class="p">(</span><span class="bp">NSArray</span><span class="w"> </span><span class="o">*</span><span class="p">)</span><span class="nv">array</span>
<span class="p">{</span>
<span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="p">(</span><span class="kt">id</span><span class="w"> </span><span class="n">object</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">array</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="k">@autoreleasepool</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="c1">// Create a lot of temporary objects</span>
<span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="p">}</span>
<span class="p">}</span>
</pre></div></li>
<li>Programs cannot call the functions <code>NSAllocateObject</code> and <code>NSDeallocateObject</code><sup id="cite_ref-Transit_9-3" class="reference"><a href="#cite_note-Transit-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup></li>
<li>Programs cannot use object pointers in C structures (<code>struct</code>s)<sup id="cite_ref-Transit_9-4" class="reference"><a href="#cite_note-Transit-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup></li>
<li>Programs cannot use memory zones (<code>NSZone</code>)<sup id="cite_ref-Transit_9-5" class="reference"><a href="#cite_note-Transit-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup></li>
<li>To properly cooperate with non-ARC code, programs must use no method or declared property (unless explicitly choosing a different getter) that starts with <code>new</code>.<sup id="cite_ref-Transit_9-6" class="reference"><a href="#cite_note-Transit-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup></li></ul>
<div class="mw-heading mw-heading3"><h3 id="Property_declarations">Property declarations</h3></div>
<p>ARC introduces some new property declaration attributes, some of which replace the old attributes.
</p>
<table class="wikitable" style="text-align: center;">

<tbody><tr>
<th scope="col" width="200">Without ARC</th>
<th scope="col" width="200">With ARC</th>
<th scope="col" width="200">With ARCLite <sup id="cite_ref-ARCLite_10-0" class="reference"><a href="#cite_note-ARCLite-10"><span class="cite-bracket">[</span>Note 1<span class="cite-bracket">]</span></a></sup>
</th></tr>
<tr>
<td><code>retain</code></td>
<td colspan="2"><code>strong</code>
</td></tr>
<tr>
<td><code>assign</code> (for object types)</td>
<td><code>weak</code></td>
<td><code>unsafe_unretained</code>
</td></tr>
<tr>
<td colspan="3"><code>copy</code>
</td></tr></tbody></table>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-ARCLite-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-ARCLite_10-0">^</a></b></span> <span class="reference-text">ARCLite is ARC but without <a href="#Zeroing_Weak_References">zeroing weak references</a> (used when deploying to a less-capable operating environment than ARC requires).</span>
</li>
</ol></div></div>
<div class="mw-heading mw-heading3"><h3 id="Zeroing_weak_references">Zeroing weak references</h3></div>
<p>Zeroing weak references is a feature in Objective-C ARC that automatically clears (sets to <code>nil</code>) weak-reference local variables, instance variables, and declared properties immediately before the object being pointed to starts deallocating. This ensures that the pointer goes to either a valid object or <code>nil</code>, and avoids <a href="Dangling_pointer" title="Dangling pointer">dangling pointers</a>. Prior to the introduction of this feature, "weak references" referred to references that were not retaining, but were not set to <code>nil</code> when the object they pointed to was deallocated (equivalent to <code>unsafe_unretained</code> in ARC), thus possibly leading to a dangling pointer. The programmer typically had to ensure that all possible weak references to an object were set to nil manually when it was being deallocated. Zeroing weak references obviates the need to do this.
</p><p>Zeroing weak references are indicated by using the <a href="#Property_Declarations">declared property attribute</a> <code>weak</code> or by using the variable attribute <code>__weak</code>.
</p><p>Zeroing weak references are only available in Mac OS X Lion (10.7) or later and iOS 5 or later, because they require additional support from the Objective-C runtime. However, some OS X classes do not currently support weak references.<sup id="cite_ref-Transit_9-7" class="reference"><a href="#cite_note-Transit-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup> Code that uses ARC but needs to support versions of the OS older than those above cannot use zeroing weak references, and therefore must use <code>unsafe_unretained</code> weak references. There exists a third-party library called PLWeakCompatibility <a rel="nofollow" class="external autonumber" href="https://github.com/plausiblelabs/PLWeakCompatibility">[1]</a> that allows one to use zeroing weak references even on these older OS versions.
</p>
<div class="mw-heading mw-heading3"><h3 id="Converting_to">Converting to</h3></div>
<p><a href="Xcode" title="Xcode">Xcode</a> 4.2 or later provides a way to convert code to ARC.<sup id="cite_ref-What's_New_in_Xcode_4.2_–_ARC_11-0" class="reference"><a href="#cite_note-What's_New_in_Xcode_4.2_–_ARC-11"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup> As of Xcode 4.5, it is found by choosing Edit &gt; Refactor &gt; Convert to Objective-C ARC... Although Xcode will automatically convert most code, some code may have to be converted manually. Xcode will inform the developer when more complex use cases arise, such as when a variable is declared inside an autorelease pool and used outside it or when two objects need to be toll-free bridged with special casts.
</p>
<div class="mw-heading mw-heading2"><h2 id="Swift">Swift</h2></div><p>
In Swift, references to objects are strong, unless they are declared <code>weak</code> or <code>unowned</code>. Swift requires explicit handling of nil with the Optional type: a value type that can either have a value or be nil. An Optional type must be handled by "unwrapping" it with a <a href="Conditional_(computer_programming)" title="Conditional (computer programming)">conditional statement</a>, allowing safe usage of the value, if present. Conversely, any non-Optional type will always have a value and cannot be nil.</p><div class="mw-highlight mw-highlight-lang-swift mw-content-ltr" dir="ltr"><pre><span class="kd">var</span> <span class="nv">myString</span><span class="p">:</span> <span class="nb">String</span> <span class="c1">// Can only be a string</span>
<span class="kd">var</span> <span class="nv">myOtherString</span><span class="p">:</span> <span class="nb">String</span><span class="p">?</span> <span class="c1">// Can be a string or nil</span>

<span class="k">if</span> <span class="kd">let</span> <span class="nv">myString</span> <span class="p">=</span> <span class="n">myOtherString</span> <span class="p">{</span> <span class="c1">// Unwrap the Optional</span>
<span class="bp">print</span><span class="p">(</span><span class="n">myString</span><span class="p">)</span> <span class="c1">// Print the string, if present</span>
<span class="p">}</span>
</pre></div><p>
Accordingly, a strong reference to an object can be of both Optional and non-Optional type (optionality and reference strength are different, albeit related, concepts). A weak reference is always of type Optional, as the object can be deallocated and the reference automatically be set to nil. Unowned references are like weak references but are not set to nil automatically by ARC. They can be either non-Optional or Optional. An unowned reference is expected to always have a value, so accessing the value of an unowned reference after the referenced instance has been deallocated, will result in a runtime error.<sup id="cite_ref-:0_12-0" class="reference"><a href="#cite_note-:0-12"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup></p><div class="mw-highlight mw-highlight-lang-swift mw-content-ltr" dir="ltr"><pre><span class="kd">var</span> <span class="nv">strongReference</span><span class="p">:</span> <span class="bp">MyClass</span> <span class="c1">// Strong non-Optional reference, cannot be nil</span>
<span class="kd">var</span> <span class="nv">strongOptionalReference</span><span class="p">:</span> <span class="bp">MyClass</span><span class="p">?</span> <span class="c1">// Strong Optional reference, can be nil (manually)</span>
<span class="kr">weak</span> <span class="kd">var</span> <span class="nv">weakReference</span><span class="p">:</span> <span class="bp">MyClass</span><span class="p">?</span> <span class="c1">// Weak reference, always Optional, can be nil (automatically or manually)</span>
<span class="kr">unowned</span> <span class="kd">var</span> <span class="nv">unownedReference</span><span class="p">:</span> <span class="bp">MyClass</span> <span class="c1">// Unowned non-Optional reference, cannot be nil</span>
</pre></div>
<p>Swift also differs from Objective-C in its usage and encouragement of <a href="Value_type" class="mw-redirect" title="Value type">value types</a> instead of <a href="Reference_type" class="mw-redirect" title="Reference type">reference types</a>. Most types in the Swift standard library are value types and they are copied by value, whereas classes and <a href="Closure_(computer_programming)" title="Closure (computer programming)">closures</a> are reference types and passed by reference. Because value types are copied when passed around, they are deallocated automatically when the program leaves the scope that contains them.<sup id="cite_ref-:0_12-1" class="reference"><a href="#cite_note-:0-12"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">[</span>12<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Smart_pointer" title="Smart pointer">Smart pointer</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<div class="reflist reflist-columns references-column-width" style="column-width: 30em;">
<ol class="references">
<li id="cite_note-Ars-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-Ars_1-0">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><cite id="CITEREFSiracusa2011" class="citation web cs1">Siracusa, John (July 20, 2011). <a rel="nofollow" class="external text" href="https://arstechnica.com/apple/2011/07/mac-os-x-10-7/10/#arc">"Mac OS X 10.7 Lion: the Ars Technica review"</a>. <i><a href="Ars_Technica" title="Ars Technica">Ars Technica</a></i>. Ars Technica. At section "Automatic Reference Counting"<span class="reference-accessdate">. Retrieved <span class="nowrap">November 17,</span> 2016</span>.</cite></span>
</li>
<li id="cite_note-Kochan-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-Kochan_2-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFKochan2011" class="citation book cs1">Kochan, Stephen G. (2011). <span class="id-lock-registration" title="Free registration required"><a rel="nofollow" class="external text" href="https://archive.org/details/programminginobj00koch"><i>Programming in Objective-C</i></a></span> (4th&nbsp;ed.). Boston, Mass.: Addison-Wesley. pp.&nbsp;<a rel="nofollow" class="external text" href="https://archive.org/details/programminginobj00koch/page/408">408</a>. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>978-0321811905</bdi>.</cite></span>
</li>
<li id="cite_note-Hoffman-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-Hoffman_3-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFHoffman2012" class="citation book cs1">Hoffman, Kevin (2012). <span class="id-lock-registration" title="Free registration required"><a rel="nofollow" class="external text" href="https://archive.org/details/samsteachyoursel0000hoff"><i>Sams teach yourself Mac OS X Lion app development in 24 hours</i></a></span>. Indianapolis, Ind.: Sams. pp.&nbsp;<a rel="nofollow" class="external text" href="https://archive.org/details/samsteachyoursel0000hoff/page/73">73</a>. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>9780672335815</bdi>.</cite></span>
</li>
<li id="cite_note-clang-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-clang_4-0">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://clang.llvm.org/docs/AutomaticReferenceCounting.html#general">"General"</a>. <i>Automatic Reference Counting</i>. LLVM.org<span class="reference-accessdate">. Retrieved <span class="nowrap">15 August</span> 2012</span>.</cite></span>
</li>
<li id="cite_note-Mention_of_ARCLite,_Inc-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-Mention_of_ARCLite,_Inc_5-0">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://developer.apple.com/library/ios/releasenotes/ObjectiveC/ObjCAvailabilityIndex/">"Objective-C Feature Availability Index"</a>. Apple, Inc<span class="reference-accessdate">. Retrieved <span class="nowrap">2013-10-14</span></span>.</cite></span>
</li>
<li id="cite_note-Sakamato-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-Sakamato_6-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFSakamoto2012" class="citation book cs1">Sakamoto, Kazuki (2012). <i>Pro Multithreading and Memory Management for iOS and OS X with ARC, Grand Central Dispatch and Blocks</i>. Apress. pp.&nbsp;xii. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>978-1430241164</bdi>.</cite></span>
</li>
<li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><cite id="CITEREFSiracusa2012" class="citation web cs1">Siracusa, John (July 25, 2012). <a rel="nofollow" class="external text" href="https://arstechnica.com/apple/2012/07/os-x-10-8/17/#objective-c-enhancements">"OS X 10.8 Mountain Lion: the Ars Technica review"</a>. <i>Ars Technica</i>. At section "Objective-C enhancements"<span class="reference-accessdate">. Retrieved <span class="nowrap">November 17,</span> 2016</span>.</cite></span>
</li>
<li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20170319065518/https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html">"Xcode 8 Release Notes"</a>. <i>Apple Developer</i>. October 27, 2016. Archived from <a rel="nofollow" class="external text" href="https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html">the original</a> on March 19, 2017<span class="reference-accessdate">. Retrieved <span class="nowrap">March 19,</span> 2017</span>.</cite></span>
</li>
<li id="cite_note-Transit-9"><span class="mw-cite-backlink">^ <a href="#cite_ref-Transit_9-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Transit_9-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-Transit_9-2"><sup><i><b>c</b></i></sup></a> <a href="#cite_ref-Transit_9-3"><sup><i><b>d</b></i></sup></a> <a href="#cite_ref-Transit_9-4"><sup><i><b>e</b></i></sup></a> <a href="#cite_ref-Transit_9-5"><sup><i><b>f</b></i></sup></a> <a href="#cite_ref-Transit_9-6"><sup><i><b>g</b></i></sup></a> <a href="#cite_ref-Transit_9-7"><sup><i><b>h</b></i></sup></a></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://developer.apple.com/library/ios/#releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html">"Transitioning to ARC Release Notes"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">14 September</span> 2012</span>.</cite></span>
</li>
<li id="cite_note-What's_New_in_Xcode_4.2_–_ARC-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-What's_New_in_Xcode_4.2_–_ARC_11-0">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20120820002015/http://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_2.html">"What's New in Xcode 4.2 – Automatic Reference Counting"</a>. Apple Inc. Archived from <a rel="nofollow" class="external text" href="https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_2.html#//apple_ref/doc/uid/00200-SW2">the original</a> on 20 August 2012<span class="reference-accessdate">. Retrieved <span class="nowrap">3 October</span> 2012</span>.</cite></span>
</li>
<li id="cite_note-:0-12"><span class="mw-cite-backlink">^ <a href="#cite_ref-:0_12-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-:0_12-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html">"Automatic Reference Counting — The Swift Programming Language (Swift 5.7)"</a>. <i>docs.swift.org</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2022-11-05</span></span>.</cite></span>
</li>
<li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://developer.apple.com/swift/blog/?id=10">"Value and Reference Types"</a>. <i>Apple Developer</i>. August 15, 2014<span class="reference-accessdate">. Retrieved <span class="nowrap">November 17,</span> 2016</span>.</cite></span>
</li>
</ol></div>
<div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2></div>
<ul><li>Transitioning to ARC – iOS Developer Library</li>
<li>"Automatic Reference Counting" in <i>The Swift Programming Language</i></li></ul>
<div class="navbox-styles"><style data-mw-deduplicate="TemplateStyles:r1129693374">
/* start https://en.wikipedia.org/ */


.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:": "}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist dd dd:first-child::before,.mw-parser-output .hlist dd dt:first-child::before,.mw-parser-output .hlist dd li:first-child::before,.mw-parser-output .hlist dt dd:first-child::before,.mw-parser-output .hlist dt dt:first-child::before,.mw-parser-output .hlist dt li:first-child::before,.mw-parser-output .hlist li dd:first-child::before,.mw-parser-output .hlist li dt:first-child::before,.mw-parser-output .hlist li li:first-child::before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child::after,.mw-parser-output .hlist dd dt:last-child::after,.mw-parser-output .hlist dd li:last-child::after,.mw-parser-output .hlist dt dd:last-child::after,.mw-parser-output .hlist dt dt:last-child::after,.mw-parser-output .hlist dt li:last-child::after,.mw-parser-output .hlist li dd:last-child::after,.mw-parser-output .hlist li dt:last-child::after,.mw-parser-output .hlist li li:last-child::after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:" ("counter(listitem)"\a0 "}


/* end https://en.wikipedia.org/ */
</style><style data-mw-deduplicate="TemplateStyles:r1236075235">
/* start https://en.wikipedia.org/ */


.mw-parser-output .navbox{box-sizing:border-box;border:1px solid #a2a9b1;width:100%;clear:both;font-size:88%;text-align:center;padding:1px;margin:1em auto 0}.mw-parser-output .navbox .navbox{margin-top:0}.mw-parser-output .navbox+.navbox,.mw-parser-output .navbox+.navbox-styles+.navbox{margin-top:-1px}.mw-parser-output .navbox-inner,.mw-parser-output .navbox-subgroup{width:100%}.mw-parser-output .navbox-group,.mw-parser-output .navbox-title,.mw-parser-output .navbox-abovebelow{padding:0.25em 1em;line-height:1.5em;text-align:center}.mw-parser-output .navbox-group{white-space:nowrap;text-align:right}.mw-parser-output .navbox,.mw-parser-output .navbox-subgroup{background-color:#fdfdfd}.mw-parser-output .navbox-list{line-height:1.5em;border-color:#fdfdfd}.mw-parser-output .navbox-list-with-group{text-align:left;border-left-width:2px;border-left-style:solid}.mw-parser-output tr+tr>.navbox-abovebelow,.mw-parser-output tr+tr>.navbox-group,.mw-parser-output tr+tr>.navbox-image,.mw-parser-output tr+tr>.navbox-list{border-top:2px solid #fdfdfd}.mw-parser-output .navbox-title{background-color:#ccf}.mw-parser-output .navbox-abovebelow,.mw-parser-output .navbox-group,.mw-parser-output .navbox-subgroup .navbox-title{background-color:#ddf}.mw-parser-output .navbox-subgroup .navbox-group,.mw-parser-output .navbox-subgroup .navbox-abovebelow{background-color:#e6e6ff}.mw-parser-output .navbox-even{background-color:#f7f7f7}.mw-parser-output .navbox-odd{background-color:transparent}.mw-parser-output .navbox .hlist td dl,.mw-parser-output .navbox .hlist td ol,.mw-parser-output .navbox .hlist td ul,.mw-parser-output .navbox td.hlist dl,.mw-parser-output .navbox td.hlist ol,.mw-parser-output .navbox td.hlist ul{padding:0.125em 0}.mw-parser-output .navbox .navbar{display:block;font-size:100%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em}body.skin--responsive .mw-parser-output .navbox-image img{max-width:none!important}@media print{body.ns-0 .mw-parser-output .navbox{display:none!important}}


/* end https://en.wikipedia.org/ */
</style></div><div role="navigation" class="navbox" aria-labelledby="Memory_management1048" style="padding:3px"><table class="nowraplinks hlist mw-collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><style data-mw-deduplicate="TemplateStyles:r1239400231">
/* start https://en.wikipedia.org/ */


.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}


/* end https://en.wikipedia.org/ */
</style><div id="Memory_management1048" style="font-size:114%;margin:0 4em"><a href="Memory_management" title="Memory management">Memory management</a></div></th></tr><tr><td class="navbox-abovebelow" colspan="2"><div>
<ul><li><a href="Memory_management_(operating_systems)" title="Memory management (operating systems)">Memory management as a function of an operating system</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Hardware</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Memory_management_unit" title="Memory management unit">Memory management unit</a> (MMU)</li>
<li><a href="Translation_lookaside_buffer" title="Translation lookaside buffer">Translation lookaside buffer</a> (TLB)</li>
<li><a href="Input%E2%80%93output_memory_management_unit" title="Input–output memory management unit">Input–output memory management unit</a> (IOMMU)</li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Virtual_memory" title="Virtual memory">Virtual memory</a></th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Demand_paging" title="Demand paging">Demand paging</a></li>
<li><a href="Memory_paging" title="Memory paging">Memory paging</a></li>
<li><a href="Page_table" title="Page table">Page table</a></li>
<li><a href="Virtual_memory_compression" title="Virtual memory compression">Virtual memory compression</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Memory_segmentation" title="Memory segmentation">Segmentation</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Protected_mode" title="Protected mode">Protected mode</a></li>
<li><a href="Real_mode" title="Real mode">Real mode</a></li>
<li><a href="Virtual_8086_mode" title="Virtual 8086 mode">Virtual 8086 mode</a></li>
<li><a href="X86_memory_segmentation" title="X86 memory segmentation">x86 memory segmentation</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Memory_allocator" class="mw-redirect" title="Memory allocator">Allocator</a></th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Dlmalloc" class="mw-redirect" title="Dlmalloc">dlmalloc</a></li>
<li><a href="Hoard_memory_allocator" title="Hoard memory allocator">Hoard</a></li>
<li><a href="Jemalloc" class="mw-redirect" title="Jemalloc">jemalloc</a></li>
<li><a href="Libumem" title="Libumem">libumem</a></li>
<li><a href="Mimalloc" title="Mimalloc">mimalloc</a></li>
<li><a href="Ptmalloc" class="mw-redirect" title="Ptmalloc">ptmalloc</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Manual_memory_management" title="Manual memory management">Manual</a> means</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Static_variable" title="Static variable">Static memory allocation</a></li>
<li><a href="C_dynamic_memory_allocation" title="C dynamic memory allocation">C dynamic memory allocation</a></li>
<li><a href="New_and_delete_(C%2B%2B)" title="New and delete (C++)">new and delete (C++)</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Garbage_collection_(computer_science)" title="Garbage collection (computer science)">Garbage<br>collection</a></th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul>
<li><a href="Boehm_garbage_collector" title="Boehm garbage collector">Boehm garbage collector</a></li>
<li><a href="Cheney's_algorithm" title="Cheney's algorithm">Cheney's algorithm</a></li>
<li><a href="Concurrent_mark_sweep_collector" title="Concurrent mark sweep collector">Concurrent mark sweep collector</a></li>
<li><a href="Finalizer" title="Finalizer">Finalizer</a></li>
<li><a href="Garbage_(computer_science)" title="Garbage (computer science)">Garbage</a></li>
<li><a href="Garbage-first_collector" title="Garbage-first collector">Garbage-first collector</a></li>
<li><a href="Mark%E2%80%93compact_algorithm" title="Mark–compact algorithm">Mark–compact algorithm</a></li>
<li><a href="Reference_counting" title="Reference counting">Reference counting</a></li>
<li><a href="Tracing_garbage_collection" title="Tracing garbage collection">Tracing garbage collection</a></li>
<li><a href="Weak_reference" title="Weak reference">Strong reference</a></li>
<li><a href="Weak_reference" title="Weak reference">Weak reference</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Memory_safety" title="Memory safety">Safety</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Buffer_overflow" title="Buffer overflow">Buffer overflow</a></li>
<li><a href="Buffer_over-read" title="Buffer over-read">Buffer over-read</a></li>
<li><a href="Dangling_pointer" title="Dangling pointer">Dangling pointer</a></li>
<li><a href="Stack_overflow" title="Stack overflow">Stack overflow</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Issues</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Fragmentation_(computing)" title="Fragmentation (computing)">Fragmentation</a></li>
<li><a href="Memory_leak" title="Memory leak">Memory leak</a></li>
<li><a href="Unreachable_memory" title="Unreachable memory">Unreachable memory</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Other</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Automatic_variable" title="Automatic variable">Automatic variable</a></li>
<li><a href="International_Symposium_on_Memory_Management" title="International Symposium on Memory Management">International Symposium on Memory Management</a></li>
<li><a href="Region-based_memory_management" title="Region-based memory management">Region-based memory management</a></li>
<li><a href="Memory_pool" title="Memory pool">Memory pool</a></li></ul>
</div></td></tr><tr><td class="navbox-abovebelow" colspan="2"><div>
<ul><li><span class="noviewer" typeof="mw:File"><span title="Category"></span></span> Memory management</li>
<li><span class="noviewer" typeof="mw:File"><span title="Category"></span></span> Virtual memory</li>
<li><span class="noviewer" typeof="mw:File"><span title="Category"></span></span> Automatic memory management</li>
<li><span class="noviewer" typeof="mw:File"><span title="Category"></span></span> Memory management algorithms</li>
<li><span class="noviewer" typeof="mw:File"><span title="Category"></span></span> Memory management software</li></ul>
</div></td></tr></tbody></table></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-07-11" href="https://en.wikipedia.org/wiki/?title=Automatic_Reference_Counting&amp;oldid=1299942372">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>